<%@ page import="com.lihuanyu.upcOA.conn.databaseUtil" %>
<%@ page import="java.sql.ResultSet" %>
<%@ page import="java.util.Calendar" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%
  int tid = 0;
  if(session.getAttribute("tid") != null) {
    tid = Integer.parseInt(session.getAttribute("tid").toString());
  }
  Calendar a= Calendar.getInstance();
  int year=a.get(Calendar.YEAR);
  //System.out.print(year);
  request.setCharacterEncoding("utf-8");
  String teaname = request.getParameter("teaname") == null ? "" : new String(request.getParameter("teaname"));
  String actyname= request.getParameter("actname") == null ? "" : new String(request.getParameter("actname"));
  String condition= request.getParameter("jcondition") == null ? "" : new String(request.getParameter("jcondition"));
  String reward= request.getParameter("reward") == null ? "" : new String(request.getParameter("reward"));
  databaseUtil db = new databaseUtil();
  String sql = "INSERT INTO `tea_activity`(`teaname`, `actyname`, `area`, `reward`, `tid`, `year`) " +
          "VALUES ('"+teaname+"','"+actyname+"','"+condition+"','"+reward+"',"+tid+","+year+")";
  System.out.print(sql);
  db.executeUpdate(sql);
%>
<tr>
  <div class="col-md-1">
    <td>教师</td>
  </div>
  <div class="col-md-1">
    <td>活动名</td>
  </div>
  <div class="col-md-1">
    <td>参见情况</td>
  </div>
  <div class="col-md-1">
    <td>获奖</td>
  </div>
</tr>
<form method="post" action="#" name="add_form">
  <tr style="display: none" class="add_row">
    <div class="col-md-1">
      <td><input type="text" name="teacher_name" id="teaname5"></td>
    </div>
    <div class="col-md-1">
      <td><input type="text" name="actname" id="actname"></td>
    </div>
    <div class="col-md-1">
      <td><input type="text" name="jcondition" id="jcondition"></td>
    </div>
    <div class="col-md-1">
      <td><input type="text" name="reward" id="reward"></td>
    </div>
  </tr>
</form>
<%
  sql="select * from tea_activity where tid="+tid;
  System.out.print(sql);
  db.executeQuery(sql);
  ResultSet rs = db.getRs();
  while (rs.next()){
    String teachername= rs.getString(2);
    String tactname =    rs.getString(3);
    String tcondition  =      rs.getString(4);
    String treward =     rs.getString(5);
%>
<tr class="second">
<div class="col-md-1">
  <td><%=teachername%></td>
</div>
<div class="col-md-1">
  <td><%=tactname%></td>
</div>
<div class="col-md-1">
  <td><%=tcondition%></td>
</div>
<div class="col-md-1">
  <td><%=treward%></td>
</div>
</tr>
<%
  }
  db.sqlclose();
%>

